package com.d3works.apps.bpm.service.init;

import com.d3works.db.JPA;
import org.camunda.bpm.engine.impl.interceptor.Session;
import org.camunda.bpm.engine.impl.interceptor.SessionFactory;
import org.camunda.bpm.engine.impl.variable.serializer.jpa.EntityManagerSession;
import org.camunda.bpm.engine.impl.variable.serializer.jpa.EntityManagerSessionImpl;

public class WkfEntityManagerSessionFactory implements SessionFactory {

  public WkfEntityManagerSessionFactory(
      Object entityManagerFactory, boolean handleTransactions, boolean closeEntityManager) {}

  @Override
  public Session openSession() {
    return new EntityManagerSessionImpl(null, JPA.em(), false, false);
  }

  @Override
  public Class<?> getSessionType() {
    return EntityManagerSession.class;
  }
}
